﻿@using OA.AspNetCore.Html;
@using OA.Model;
@using OA.Model.View;
@using X.PagedList;
@using OA.Core.Helper;

@model PageList<Diary>
@{
    ViewBag.Title = "工作日志列表";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm">
        <form action="" class="layui-form">
            <div class="layui-inline">
                <label class="layui-form-label">开始时间：</label>
                <div class="layui-input-inline">
                    <input type="text" name="startTime" class="layui-input mydate" id="startTime" data-type="date" placeholder="开始时间" autocomplete="off" data-format="yyyy-MM-dd" />
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间：</label>
                <div class="layui-input-inline">
                    <input type="text" name="endTime" class="layui-input mydate" id="endTime" data-type="date" placeholder="结束时间" autocomplete="off" data-format="yyyy-MM-dd" />
                </div>
            </div>
            <button type="button" class="layui-btn searchButton">搜索</button>
            <a class="layui-btn" href="javascript:ShowPage('/Member/Diary/Create','添加工作日志')">添加工作日志</a>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:15}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>

                <th lay-data="{field:'DateTime', width:120}">日期</th>
                <th lay-data="{field:'CreateDateTime', width:180}">添加日期</th>
                <th lay-data="{field:'Details', }">内容</th>
                <th lay-data="{width:140, align:'right', toolbar: '#barDemo'}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Member/Diary/Edit/{{d.ID}}','修改工作日志')">修改</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:DeleteItem('{{d.ID}}')" >删除</a>
    </script> 
</div>
<script type="text/javascript">
    function DeleteItem(currentID) {
    layer.confirm('您正在进行删除工作日报操作', {
        btn: ['是的', '不小心点错了']
    }, function () {
        var url = "/Member/Diary/Delete?id=" + currentID;
        $.getJSON(url, function (data) {
            if (data.State === 200) {
                layer.msg("工作日报删除成功");
                $(".layui-laypage-btn")[0].click();
            }
            else {
                layer.msg(data.Message);
            }
        });
    }, function () {

    });
}
</script>


